package com.sh.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sh.exception.CustomException;

/**
 * 错误的控制层
 * 一些无法再 controller层捕获的错误，全部发送到当前 controller
 * */
@RestController
public class ErrorController {
    /**
     * 重新抛出异常
     */
    @RequestMapping("/error/exthrow")
    public void rethrow(HttpServletRequest request) {
        throw ((CustomException) request.getAttribute("filter.error"));
    }
}
